#!/bin/sh
# 
# do some preparation before run
#

APPNAME=dae

# work dir
WORKDIR=$HOME/tmp/$APPNAME
TTDIR=$WORKDIR/tt

# stop tokyo-tyrant server

PIDFILE=$TTDIR/tt.pid
while [ -f $PIDFILE ]; do
	PID=`cat $PIDFILE`
	kill $PID
	ps $PID >/dev/null 2>/dev/null
	if [ $? -eq 0 ]; then
		sleep 1
	else
		if [ -f $PIDFILE ]; then
			rm -f $PIDFILE
		fi
		break
	fi
done

exit 0

